﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using cms.libs;

namespace CMS
{
    public partial class ReportAccountRoomInfo : System.Web.UI.Page
    {
        private int AccountId;
        private int RoomID;
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((Request.QueryString["accid"] != null) || (Request.QueryString["rid"] != null))
            {
                int.TryParse(Request.QueryString["accid"].ToString(), out AccountId);
                int.TryParse(Request.QueryString["rid"].ToString(), out RoomID);
            }
            else
            {

            }

            if (!IsPostBack)
            {
                txtFromDate.SelectedDate = DateTime.Now.AddDays(-10);
                txtToDate.SelectedDate = DateTime.Now;
                BindData();
            }
        }
        protected void BindData()
        {
            DateTime fromD = txtFromDate.SelectedDate.Value;
            DateTime toD = txtToDate.SelectedDate.Value;
            int AccountId = 0;
            //int.TryParse(txtAccountId.Text.Trim(), out AccountId);
            DataTable lst = new DBAccountReport().GetListByACcIdAndRoomId(int.Parse(toD.ToString()), AccountId, RoomID);

            GridView1.DataSource = lst;
            GridView1.DataBind();
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            BindData();
        }

        protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            GridView1.PageIndex = e.NewPageIndex;
            BindData();
        }
    }
}